package com.bicon.botu.mall.component.api;

import com.bicon.botu.mall.component.common.BannerConstants;
import com.bicon.botu.mall.component.service.IBannerService;
import com.bicon.botu.mall.component.dto.BannerDto;
import com.bicon.botu.core.base.common.controller.BaseController;
import com.bicon.botu.core.base.common.entity.BaseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 轮播图 前端控制器
 *
 * @author 张凡
 * @date 2017/7/19 下午 14:49
 */
@RestController
@RequestMapping("/V1.0.0/api/base/banner")
public class BannerApi extends BaseController {
    @Autowired
    IBannerService iBannerService;

    /**
     * 获取轮播图详情
     *
     * @param bannerModular  轮播图模块
     * @param bannerPosition 轮播图位置
     * @return
     */
    @RequestMapping(value = "/getBannerDetailFromRedis", method = RequestMethod.POST)
    public BaseResult getBannerDetailFromRedis(@RequestParam(value = "bannerModular") Integer bannerModular,
                                               @RequestParam(value = "bannerPosition") Integer bannerPosition) {
        List<BannerDto> banners = iBannerService.getBannerDetailFromRedis(bannerModular, bannerPosition);
        return new BaseResult(BannerConstants.RESPONSE_CODE_200, BannerConstants.RESPONSE_MESSAGE_200, banners);
    }

}
